package cn.java86.test;

import cn.java86.dao.StudentDao;
import cn.java86.entity.Student;
import cn.java86.util.MybatisUtil;
import cn.java86.util.StrUtil;
import org.apache.ibatis.session.SqlSession;

/**
 * @author oldliu
 * @since 1.0
 */
public class AddStudent {
    public static void main(String[] args) {
        SqlSession s= MybatisUtil.get();
        StudentDao mapper = s.getMapper(StudentDao.class);

        Student st=new Student();
        st.setSname("王久瑞");
        st.setGradeid(7L);
        st.setSex("男");
        st.setEnterdate(StrUtil.toDate("2023-4-15"));
        st.setBirthday(StrUtil.toDate("2001-5-15"));
        mapper.add(st);
        s.commit();
        MybatisUtil.close(s);
    }
}
